﻿using System;
using System.IO;
using Fee.Orders;
using Fee.Orders.AuthProjectWorkflow;
using Fee.Orders.DesignWorkflow;
using Identity;

namespace Fee.FileAttachs
{
    public class FileAttach
    {
        public FileAttach()
        {
        }

        public FileAttach(string name, string filePath)
        {
            Name = name;
            SystemPath = filePath;
        }

        public int Id { get; set; }
        public string Name { get; set; }
        public string SystemPath { get; set; }
        public DateTimeOffset CreateTime { get; set; } = DateTimeOffset.Now;

        public User UploadUser { get; set; }

        public void CopyTo
            (string folder)
        {
            File.Copy(SystemPath, folder);
        }
    }

    public class ConstructionTaskFileAttach
    {
        public FileAttach File { get; set; }
        public ConstructionTask Task { get; set; }

        public int FileId { get; set; }
        public int TaskId { get; set; }
    }

    public class AuthProjectOrderFileAttach
    {
        public FileAttach File { get; set; }
        public AuthProjectOrder Order { get; set; }

        public int FileId { get; set; }

        public int OrderId { get; set; }
    }

    public class BudgetOrderFileAttach
    {
        public FileAttach File { get; set; }
        public BudgetOrder Order { get; set; }

        public int FileId { get; set; }

        public int OrderId { get; set; }
    }
}